<template>
	<view style="padding: 0 72rpx;padding-top: 180rpx;">
		<view style="">
			<u-image src="/static/login/loginLog.svg" style="display: flex;flex-direction: row;" width="65%"
				height="auto" mode="widthFix"></u-image>
		</view>
		<!-- <u--input style="margin-top: 80rpx;" :placeholder="$t('registration_phone')" prefixIcon="/static/login/phone.png"
			:prefixIconStyle="{width:'25rpx','padding-right':'15rpx'}" border="bottom" clearable></u--input> -->

		<u-input style="margin-top: 80rpx;" :customStyle="{'padding-left':'10rpx'}" v-model="query.Email"
			:placeholder="$t('registration_email')" border="bottom" clearable>
			<u-icon slot="prefix" size="25" name="email"></u-icon>
		</u-input>
		<u-button color="#2A3954" @click="getdata"
			:customStyle="{'height':'82rpx','border-radius':'30rpx','margin-top':'140rpx','font-size':'36rpx'}"
			text="save"></u-button>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				passtype: true,
				query: {
					"Email": "",
					"AppID": "119"
				},
				issend:false,
				mintin:60,
				Time:null
			};
		},
		onLoad() {
			// uni.setNavigationBarTitle({
			// 	title: this.$t('repassword_title')
			// });
		},
		computed:{
			nowstr(){
				if(this.issend){
					return mintin
				}
				return this.$t('repassword_msg')
			}
		},
		methods: {
			send(){
				if(this.issend){
					return 
				}
				this.mintin = 60;
				this.$store.commit('postdata', {
					url: '/api/Manager/ForgetPasswordSendCode',
					data: {Email:this.query.Email,AppID:this.query.AppID},
					success(res) {
						console.log(res)
						uni.$u.toast(res.Message);
						if (res.State == 0) {
							this.issend = true;
							this.changetime()
						}
					},
					error(res) {
						uni.$u.toast('server error');
					}
				})
			},
			changetime(){
				this.Time = setInterval(()=>{
					this.mintin = this.mintin - 1;
					if(this.mintin == 0){
						clearInterval(this.Time);
						this.issend = false;
					}
				},1000)
			},
			settype() {
				if (this.passtype) {
					this.passtype = false
				} else {
					this.passtype = true
				}
			},
			settype1() {
				if (this.passtype1) {
					this.passtype1 = false
				} else {
					this.passtype1 = true
				}
			},
			getdata() {
				this.$store.commit('postdata', {
					url: '/api/Manager/ForgetPasswordInputCode',
					data: this.query,
					success(res) {
						uni.$u.toast(res.Message);
						if (res.State == 0) {
							setTimeout(() => {
								uni.$u.route({
									url: '/pages/login/login',
									type: 'back'
								})
							}, 1500)
						}
					},
					error(res) {
						uni.$u.toast('server error');
					}
				})
			}
		}
	}
</script>
<style>
	.u-border-bottom {
		border-color: #2A3954 !important;
		border-width: 1px !important;
	}
</style>
<style lang="scss">

</style>
